package com.xsz.pda.utils;

import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;

import com.xsz.pda.R;


public class SoundPoolUtil {
    private  SoundPool soundPool;
    public static int YZCG;//验证成功
    public static int YZSB;//验证失败
    public static int CSYW;//入场次数已用完
    public static int RCKCW;//入场口错误
    public static int CZCG;//重置成功
    public static int CZSB;//重置成功

    public static int WXPZ;//无效票证
    public static int RCSJCW;//入场时间错误

    public SoundPoolUtil(Context context) {
        soundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 10);
        //加载音频文件
        YZSB = soundPool.load(context, R.raw.sound_yzsb, 0);
        YZCG = soundPool.load(context, R.raw.sound_yzcg, 1);
        RCKCW =soundPool.load(context, R.raw.gate_wrong, 2);
        CSYW = soundPool.load(context, R.raw.no_times, 3);
        CZCG = soundPool.load(context, R.raw.sound_czcg, 4);
        CZSB = soundPool.load(context, R.raw.sound_czsb, 5);
        WXPZ = soundPool.load(context, R.raw.wxpz, 6);
        RCSJCW = soundPool.load(context, R.raw.rcsjcw, 7);
    }

    //播放音频
    public void play(int number) {
        soundPool.play(number, 0.9f, 0.9f, 0, 0, 1);
    }

    public void release(){
        soundPool.release();
    }
}
